// import { defineConfig } from 'vite'
// import vue from '@vitejs/plugin-vue'

// // https://vitejs.dev/config/
// export default defineConfig({
//   plugins: [vue()],
  
// })

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import {resolve} from 'path'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  resolve:{
    alias:{
      '@':resolve(__dirname,'src')
    }
  },
  server: {
    host: '0.0.0.0',
    port: 3005,
    proxy: {
      ['/dev-api']: {
        changeOrigin: true,
        target: 'https://api.realworld.io/api',
        rewrite: (path)=>{
          console.log(path);
          let path_new = path.replace(new RegExp('^\/dev-api'),'')
          console.log(path_new)
          return path_new
        }
      }
    }
  }
})
